home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / demos / blitterscreen / bs2x1.s < prev    next >
Text File  |  1980-01-03  |  4KB  |  185 lines

  1. * Standard beginner code
  2.  
  3. * $VER: d.s (7.5.95)
  4.  
  5.    SECTION DEMO
  6.  
  7.    INCLUDE d.8.95.i
  8.  
  9. * -----MEM definitions
  10.  
  11. ***chip equ 100*1024
  12.  
  13.    clrstruct
  14. *
  15.    struct cop0,4096
  16.    struct cop1,4096
  17.  
  18.    struct scr0,320*256
  19.    struct scr1,320*256
  20.    struct ch0,320*256
  21.    struct ch1,320*256
  22.    struct buf2,320*256*2
  23.    struct sblbuf,320*256
  24.    struct sprbuf,(312*8*2)*8
  25. *
  26.    struct chipend,1
  27. chip equ chipend      
  28. * - - - - - - -
  29. ***fast equ 100*1024
  30. *
  31.    clrstruct
  32. *
  33.    struct blist,40*1024 ;?
  34. *
  35.    struct fastend,1
  36. fast equ fastend
  37.  
  38. *----Copperlistheader for blitterscreen, to be copied to chipmem (!)
  39. copl:
  40.      dc.l $01fc000f ;fmode=3  ;SPRfmode=3 ; 2x1: no SCANDOUBLE planes
  41.      dc.l $00968100           ;plane dma on line 0
  42.      dc.l $01000211,$01020000 ;LORES 8 planes, ECS on for bblank
  43.      dc.l $0104003f           ;$104 sprite priority!
  44.      dc.l $01060020           ;$1060020: bblank
  45.      dc.l $010c0000           ;$10c: sprite-colorbank (!)
  46.      dc.l $01080000,$010a0000 ;2x1: modulos 0
  47.      dc.l $008e2881,$009028c1 ;display window
  48.      dc.l $00920038,$009400a0 ;ddfstrt/stp values for 320pix-width-plane
  49.  
  50. * don't look at copl2, it's used by my startup-code...
  51. * don't forget to put $fffffffe into your coplist after calling mk2xY!
  52.  
  53. copl2:
  54.      dc.l $00e00000,$00e20000
  55.      dc.l $00e40000,$00e60002
  56.      dc.l $00e80000,$00ea0004
  57.      dc.l $00ec0000,$00ee0006
  58.      dc.l $00f00000,$00f20008
  59.      dc.l $00f40000,$00f6000a
  60.      dc.l $00f80000,$00fa000c
  61.      dc.l $00fc0000,$00fe000e
  62. coplend:
  63.      dc.l $fffffffe
  64.  
  65. * ==============================
  66. prg:
  67.    include bltscr.h
  68.  
  69. ** INTERRUPTs
  70.    move.w #$0030,$dff09c
  71.    move.l _vbr,a0 : lea $6c(a0),a0 : move.l #int3,(a0)
  72.    move.w #$8060,$dff09a
  73.  
  74.  
  75. * SCREEN
  76.    move.l chipmem,a0 : add.l #cop0,a0
  77.    move.l chipmem,a1 : add.l #scr0,a1
  78.    jsr mkbltscr                         ;create coplist
  79.  
  80.    move.l chipmem,a0 : add.l #cop0,a0 : move.l a0,$dff080
  81.  
  82.  
  83.    move.l chipmem,a0 : add.l #ch0,a0
  84.    move.w #320*256/4-1,d7
  85. clch:
  86.    move.l #$ffffffff,(a0)+ : dbra d7,clch
  87.  
  88.    move.l chipmem,a0 : add.l #scr0,a0
  89.    move.w #320*256/4-1,d7
  90. clscr:
  91.    move.l #$00000000,(a0)+ : dbra d7,clscr
  92. ***
  93.  
  94.    move.l fastmem,a6 : add.l #blist,a6    ;buffer for blitterlist
  95.  
  96.    move.l chipmem,a0 : add.l #ch0,a0      ;chunky buffer
  97.    move.l chipmem,a1 : add.l #scr0,a1     ;planar screen; 4 planes (memwise)
  98.  
  99.    move.l chipmem,a2 : add.l #buf2,a2     ;pass-buffer
  100.    move.l chipmem,a3 : add.l #sblbuf,a3   ;scramble-buffer
  101.  
  102.    move.l #160*256,d0                     ;nr of chunky pixels
  103.    move.l #320*256/8,d1                   ;distance of the 4 planes
  104.  
  105.   movem.l d0-d7/a0-a6,-(sp)
  106.    jsr sc2bs                 ;hehehe =:)) adios copperscreen...
  107.   movem.l (sp)+,d0-d7/a0-a6
  108.  
  109. ***
  110.    move.l chipmem,a5 : add.l #ch0,a5
  111.    lea scramble,a4
  112.  
  113. ;actually #?c2bs tests for blitterqueue finished, too
  114. ;just to let you know the flag (all jobs done: flag=0)
  115. loop:
  116.    tst.w bltbsy : bne loop
  117.  
  118.    move.l timer,d0 : add.l #0,d0
  119. wvbl:
  120.    cmp.l timer,d0 : bge wvbl
  121.  
  122. *
  123.    move.l fastmem,a6 : add.l #blist,a6    ;buffer for blitterlist
  124.    move.l a6,bltpc         ;blitterqeue
  125.    move.w #1,bltbsy        ;important!
  126.    move.w #$8040,$dff09c   ;activate blit intreq, blitter starts now.
  127. *
  128.  
  129.    move.b d4,(a5) : add.b #$1,d4
  130.  
  131. ;this line if called c2bs
  132. ***   addq.w #1,a5 ;no scramble :)
  133. ;this line if called sc2bs
  134.    add.w (a4)+,a5 : cmp.l #scrambleend,a4 : bne noadj : lea scramble,a4
  135. noadj:
  136.  
  137. wait:
  138.    move.w #0,$dff182
  139.    btst #2,$dff016
  140.    bne loop
  141.  
  142. prgrts:
  143.    tst.w bltbsy : bne prgrts
  144.    rts
  145.  
  146. scramble dc.w 4,-2,4,-5,4,-2,4,1 ; =@)
  147. scrambleend:
  148.  
  149. *** COPPERLIST FOR BLITTERSCREEN
  150. * a0: copscr
  151. * a1: scr
  152.  
  153. mkbltscr:
  154.    move.l a1,-(sp)     ;#^#
  155.  
  156. ;stdheader
  157.    move.l #copl,a3 : move.l #copl2-copl,d1
  158.  
  159.    move.l chipmem,a1
  160.    add.l #scr0,a1
  161.    move.l #320*256/8,d0
  162.    jsr maksimplecop
  163.  
  164.    move.l (sp)+,a1     ;#^#
  165.  
  166. ** 2xY
  167.    move.l a1,d0   ;adr plane0
  168.  
  169.    move.l #$28,d2 ;ystart 
  170.    move.l #128,d3 ;anz lines
  171.    move.l #40*256,d4 ;planesize
  172.    move.l #40,d5     ;linesize
  173.  
  174.    move.l chipmem,a2 : add.l #sprbuf,a2
  175.  
  176.    jsr mk2xY
  177.  
  178. ** don't forget this! (feel free to add your own copper stuff)
  179.    move.l #$fffffffe,(a0)+
  180.  
  181.    rts
  182.  
  183.    END
  184.  
  185.